package com.g24.partychecker;

import android.app.TabActivity;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.TabHost;

public class Hoofdscherm extends TabActivity {
    private int MENU_INSTELLINGEN;

	/** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.hoofdscherm);
        
        Resources res = getResources(); // Resource object to get Drawables
        TabHost tabHost = getTabHost();  // The activity TabHost
        TabHost.TabSpec spec;  // Resusable TabSpec for each tab
        Intent intent;  // Reusable Intent for each tab

        intent = new Intent().setClass(this, Favorieten.class);
        spec = tabHost.newTabSpec("favorieten").setIndicator("Favorieten", res.getDrawable(R.drawable.ic_tab_favorieten)).setContent(intent);
        tabHost.addTab(spec);

        intent = new Intent().setClass(this, Feesten.class);
        spec = tabHost.newTabSpec("feesten").setIndicator("Feesten", res.getDrawable(R.drawable.ic_tab_feesten)).setContent(intent);
        tabHost.addTab(spec);

        tabHost.setCurrentTab(0);
    }
    
    /* Creates the menu items */
    @Override
    public boolean onCreateOptionsMenu(Menu menu)
    {
        menu.add(0, MENU_INSTELLINGEN, 0, "Instellingen").setIcon(R.drawable.ic_menu_upload);
        return true;
    }

    /* Handles item selections */
    public boolean onOptionsItemSelected(MenuItem item) 
    {
    	if(item.getItemId() == MENU_INSTELLINGEN) 
        {
    		naarInstellingen();
			return true;
        }
        return false;
    }

	private void naarInstellingen() 
	{
		Intent i = new Intent(Hoofdscherm.this, Instellingen.class);
        startActivity(i);		
	}
}